package Exercises;/*
 *
 * @author 陈粒
 * @version 创建时间：2021/7/5 11:49
 */

import java.util.*;

public class MergingArrays {
    public static void main(String[] args) {
        int a[] = suiji1();
        int b[] = suiji2();
        int[] newab = new int[a.length + b.length];
        for (int i = 0; i <= a.length - 1; i++) {
            newab[i] = a[i];
        }
        for (int i = 0; i <= b.length - 1; i++) {
            newab[a.length + i] = b[i];
        }
        Arrays.sort(newab);
        System.out.println(Arrays.toString(newab));
    }

    public static int[] suiji1() {
        int[] a = new int[10];
        for (int i = 0; i < 10; i++) {
            a[i] = new Random().nextInt(100) + 1;
        }
        return a;
    }

    public static int[] suiji2() {
        int[] b = new int[10];
        for (int i = 0; i < 10; i++) {
            b[i] = new Random().nextInt(100) + 1;
        }
        return b;
    }
}
